<html>

<head>
    <HTA:APPLICATION ID="SeleniumHTARunner" APPLICATIONNAME="Selenium" />
        <!-- the previous line is only relevant if you rename this
     file to "TestRunner.hta" -->

        <!-- The copyright notice and other comments have been moved to after the HTA declaration,
to work-around a bug in IE on Win2K whereby the HTA application doesn't function correctly -->
        <!--
        Copyright 2004 ThoughtWorks, Inc

         Licensed under the Apache License, Version 2.0 (the "License");
         you may not use this file except in compliance with the License.
         You may obtain a copy of the License at

             http://www.apache.org/licenses/LICENSE-2.0

         Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS,
         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         See the License for the specific language governing permissions and
         limitations under the License.
        -->
        <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>

        <title>General Interface Test Automation Kit (GITAK) TestRunner - Selenium</title>
		
        <link rel="stylesheet" type="text/css" href="selenium.css"/>
        <script type="text/javascript" src="scripts/xmlextras.js"></script>
        <script language="JavaScript" type="text/javascript" src="lib/prototype.js"></script>
        <script language="JavaScript" type="text/javascript" src="lib/cssQuery/cssQuery-p.js"></script>
        <script language="JavaScript" type="text/javascript" src="lib/snapsie.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/htmlutils.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/ui-element.js"></script>
<script language="JavaScript" type="text/javascript" src="scripts/se2html.js"></script> 
        <script language="JavaScript" type="text/javascript" src="lib/scriptaculous/scriptaculous.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/selenium-browserdetect.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/selenium-browserbot.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/find_matching_child.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/selenium-api.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/selenium-commandhandlers.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/selenium-executionloop.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/selenium-testrunner.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/selenium-logging.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/selenium-version.js"></script>
        <script language="JavaScript" type="text/javascript" src="xpath/util.js"></script>
        <script language="JavaScript" type="text/javascript" src="xpath/xmltoken.js"></script>
        <script language="JavaScript" type="text/javascript" src="xpath/dom.js"></script>
        <script language="JavaScript" type="text/javascript" src="xpath/xpath.js"></script>
        <script language="JavaScript" type="text/javascript" src="xpath/javascript-xpath-0.1.11.js"></script>
        <script language="JavaScript" type="text/javascript" src="scripts/user-extensions.js"></script>
        <script language="JavaScript" type="text/javascript">
            function openDomViewer() {
              var autFrame = document.getElementById('selenium_myiframe');
              var autFrameDocument = new SeleniumFrame(autFrame).getDocument();
              this.rootDocument = autFrameDocument;
              
              /*GITAK's GI DOM viewer, accessible after executing first extended command (e.g. clickJsxElement|JsxMenuName|) */
              try {
                  //jsx3.require("jsx3.gui.Window");
                  var JSXBODY = jsx3.GO('JSXBODY');
                  var currentUrl = window.location.href; // get selenium path from browser URL
                  var start_page = currentUrl.split('?')[0]; // get first part without parameters
                  var localpath = start_page.slice(0, start_page.lastIndexOf('/selenium'));
                  console.debug(JSXBODY);
                  //console.debug(localpath +'/domviewer/JsxDom32/js/logic.js');
                  //console.debug(localpath +'/domviewer/JsxDom32/components/dlgJsxDom.xml');
                  
                  JSXBODY.getServer().loadInclude(localpath +'/domviewer/JsxDom32/js/logic.js', 'domjs', 'script', false);
                  if (!browserVersion.isIE || !browserVersion.isHTA) {
                      JSXBODY.load(localpath +'/domviewer/JsxDom32/components/dlgJsxDom.xml');
                  } else {
                      var w = JSXBODY.getServer().getAppWindow("DomWin");
                      if (w == null) {
                        w = JSXBODY.getServer().createAppWindow("DomWin");
                        w.setHeight(400);
                        w.setWidth(500);
                        w.setTitle("JSX DOM");
                        w.setResizable(true);
                      
                        w.unsubscribe(jsx3.gui.Window.WILL_CLOSE, this, handleClose);
                        w.subscribe(jsx3.gui.Window.WILL_CLOSE, this, handleClose);

                        w.getRootBlock().load(localpath +'/domviewer/JsxDom32/components/dlgJsxDom.xml');
                      }
                      if (!w.isOpen()) { //and show the window if it isn'talready visible
                        w.open();
                      }
                      w.focus();
                  }
                } catch (e) {                   
                    /* Use Selenium DOM viewer if GI DOM viewer not available */
                    var domViewer = window.open(getDocumentBase(document) + 'domviewer/domviewer.html');              
                }
                return false;
            }
            
            function handleClose() {
                var JSXBODY = jsx3.GO('JSXBODY');
                var w = JSXBODY.getServer().getAppWindow("DomWin");
                if (w.doClose)
                  w.doClose();
                else {
                 if (w.getRootBlock().getChild(0))
                   w.getRootBlock.removeChildren();
                  w.close();
                }
            }
            
            function toggleBannerDisplay(elm) {
                if (elm.style.display == "") {
                    elm.style.display = "none";
                }
                else
                  elm.style.display = "";
            }

			function checkMode() {
        // multi-window enabled then hide banner
				if (htmlTestRunner && htmlTestRunner.controlPanel.isMultiWindowMode())
          toggleBannerDisplay($('banner'));
			}
        </script>
</head>

<body onLoad="onSeleniumLoad();setTimeout(function() {checkMode();}, 1000);">


<table class="layout">
<form action="#" name="controlPanel">

<tr id="banner" height="30" onclick="toggleBannerDisplay(this);" title="click here to minimize banner">
  <td colspan="3" bgcolor="#346AA5">
     <img src="../../image/GITAK_banner.jpg" style="width:100%;" align="left" alt="click here to minimize banner"/>
  </td>
</tr>

<!-- Suite, Test, Control Panel -->

<tr class="selenium">
<td width="25%" height="30%">
    <iframe name="testSuiteFrame" id="testSuiteFrame" src="./TestPrompt.html" application="yes"></iframe>
</td>
<td width="50%" height="30%">
    <iframe name="testFrame" id="testFrame" application="yes" src="Blank.html"></iframe>
</td>

<td width="25%">
    <table class="layout">
        <tr class="selenium">
            <th style="height: 30px;">
                <a href="http://www.generalinterface.org/"><img src="../../image/GI_jumpTab.gif" style="border:0;width:100%;" alt="www.generalinterface.org"/>
                </a>
            </th>
        </tr>
        <tr>
            <td width="25%" height="30%" id="controlPanel">
                <fieldset>
                    <legend>Execute Tests</legend>

                    <div id="imageButtonPanel">
                        <button type="button" id="runSuite" onClick="htmlTestRunner.startTestSuite();$('banner').style.display='none';"
                                title="Run All tests" accesskey="a">
                        </button>
                        <button type="button" id="runSeleniumTest" onClick="htmlTestRunner.runSingleTest();$('banner').style.display='none';"
                                title="Run the Selected test" accesskey="r">
                        </button>
                        <button type="button" id="pauseTest" disabled="disabled"
                                title="Pause/Continue" accesskey="p" class="cssPauseTest">
                        </button>
                        <button type="button" id="stepTest" disabled="disabled"
                                title="Step" accesskey="s">
                        </button>
                    </div>

                    <div style="float:left">Fast</div>
                    <div style="float:right">Slow</div>
                    <br/>
                    <div id="speedSlider">
                        <div id="speedTrack">&nbsp;</div>
                        <div id="speedHandle">&nbsp;</div>
                    </div>

                    <div class="executionOptions">
                        <input id="highlightOption" type="checkbox" name="highlightOption" value="0"/>
                        <label for="highlightOption">Highlight elements</label>
                    </div>

                </fieldset>

                <table id="stats" align="center">
                    <tr>
                        <td colspan="2" align="right">Elapsed:</td>
                        <td id="elapsedTime" colspan="2">00.00</td>
                    </tr>
                    <tr>
                        <th colspan="2">Tests</th>
                        <th colspan="2">Commands</th>
                    </tr>
                    <tr>
                        <td class="count" id="testRuns">0</td>
                        <td>run</td>
                        <td class="count" id="commandPasses">0</td>
                        <td>passed</td>
                    </tr>
                    <tr>
                        <td class="count" id="testFailures">0</td>
                        <td>failed</td>
                        <td class="count" id="commandFailures">0</td>
                        <td>failed</td>
                    </tr>
                    <tr>
                        <td colspan="2"></td>
                        <td class="count" id="commandErrors">0</td>
                        <td>incomplete</td>
                    </tr>
                </table>

                <fieldset>
                    <legend>Tools</legend>

                    <button type="button" id="domViewer1" onClick="openDomViewer();">
                        View DOM
                    </button>
                    <button type="button" onClick="LOG.show();">
                        Show Log
                    </button>

                </fieldset>

            </td>
        </tr>
    </table>
</td>
</tr>

<!-- AUT -->

<tr>
    <td colspan="3" height="70%">
        <iframe name="selenium_myiframe" id="selenium_myiframe" src="TestRunner-splash.html" application="yes"></iframe>
    </td>
</tr>

    </form>
    </table>

</body>
</html>
